package at.sysarch.filter;

import java.util.LinkedList;

import javax.media.jai.PlanarImage;

import at.sysarch.utils.ImageChangedEvent;
import at.sysarch.utils.ImageChangedListener;

public abstract class AbstractListenerManager {

	LinkedList<ImageChangedListener> listeners = new LinkedList<ImageChangedListener>();

	protected void fireImageChanged(PlanarImage image) {
		ImageChangedEvent event = new ImageChangedEvent(this, image);
		// informs all who listen to roifilter
		for (ImageChangedListener listener : listeners) {
			listener.imageChanged(event);
		}
	}

	public void addImageChangedListener(ImageChangedListener listener) {
		listeners.add(listener);
	}

	public void removeImageChangedListener(ImageChangedListener listener) {
		listeners.remove(listener);
	}
}
